package com.zk.junit4;

import com.zk.AppTest;
import com.zk.manual.LogClassFileTransformer;
import net.bytebuddy.agent.ByteBuddyAgent;
import org.junit.runner.JUnitCore;
import org.junit.runner.notification.RunListener;
import org.junit.runners.JUnit4;

import java.lang.instrument.Instrumentation;


public class JunitRunListenerDemo {


    public static void main(String[] args) throws Exception {
        Instrumentation instrumentation = ByteBuddyAgent.install();
        instrumentation.addTransformer(new LogClassFileTransformer(), true);



        JUnitCore junitCore = new JUnitCore();
        RunListener runListener = new Junit4DemoRunListener();
        junitCore.addListener(runListener);


        junitCore.run(new JUnit4(AppTest.class));

    }


}
